$(function(){
	
	var cjNum=0; // 抽奖次数
	var zhongjianged = false;
	var showxhrfloot = false; // 小黄人乐园浮层提示
	var showxmyckfloot = false; // 熊猫隐藏款
	var show3cj = false; // 显示集三抽奖
	var showallcj = false; // 显示集齐所有抽奖
	
	var clickBtnName='';
	var clickBtnStep = '';
	var pointname=['floot-shuisj','floot-xm','floot-hlbt','floot-bxjg','floot-zlj','floot-hlw','floot-xhr']; // 定位点名称
	var goStep = 0;  // 地位步骤
	var getPoint = false;  // 开启地图定位
	
	flootfn()
	$(window).resize(function(){
		flootfn()
	})
	
	function flootfn(){
		var hh = $(window).height();
		$(".rulebox").css({height:hh + 'px'});
		$(".flootBox").css({height:hh + 'px'});
		$(".flootcjBox").css({height:hh + 'px'});
		$(".loadingbox").css({height:hh + 'px'});
		$(".beibaobox").css({height:hh + 'px'});
		$(".dhcodebox").css({height:hh + 'px'});
		$(".dwfloottsbox").css({height:hh + 'px'});
		
		
		var bottomH = $(".bottomBox")[0].offsetHeight;
		$(".bottomBox").css({top:(hh-bottomH+5)+'px'})
		console.log(bottomH)
	}
	
	var scrollo = new BScroll('.rulescrollbox',{
	    scrollY: true,
	    scrollbar: {
		 fade: false,
		 interactive: false 
		},
		click: true,
		startY:0, 
		bounce:true, 
		pullUpLoad:{
			threshold:0 /*在上拉到超过底部 20px 时，触发 pullingUp 事件*/
			}
	})
	
	
	loadImg("images/ruletxt.png" , function(){
		console.log("txt-loadingend")
		scrollo.refresh();
	})
	
	/* $(".btndl").click(function(e){
		e.preventDefault();
		if(getPoint){return}
		var itemName = $(this).attr("item");
		$("."+itemName).css({display:"block"});
		$(this)[0].clicked = true;
		
		
		if(itemName == 'floot-xhr' && !showxhrfloot){
			showxhrfloot=true;
			
			$(".flootcjxhrBox").fadeIn(400)
			$(".jiangpinlistbox").append('<img src="images/btn-dh.png" class="jpListitem dhbtn" />'); 
			setTimeout(function(){
				usehqxyefn();
			},10)
			
			
		}else if(itemName == 'floot-xm' && !showxmyckfloot){
			showxmyckfloot=true;
			$(".flootcjxmBox").fadeIn(400) //css({display:"block"});
			
			
			cjTips()
		}else{
			flootShowfn()
			
		}
		
	}) */
	
	$(".btnhuizhang").click(function(e){
		e.preventDefault();
		$(".beibaobox").fadeOut(200)//css({display:"none"})
		$(".dhcodebox").fadeOut(200)
		flootShowfn();
	})
	
	function cjTips(){
		cjNum++;
		if(cjNum>3){
			cjNum=3;
		}
		$(".tips").text(cjNum).css({display:"block"})
	}
	
	//关闭隐藏熊猫打开抽奖
	$(".closecjxmbtn").click(function(e){
		e.preventDefault()
		//$(".flootcjxmBox").fadeOut(400) //css({display:"block"})
		//TweenMax.to(".flootcjxmBox",0.4,{opacity:0,scale:1.3,repeat:0,delay:0,onComplete:function(){
			//$(".flootcjxmBox").css({display:"none"});
			//flootShowfn()
			
		//}})
		closexmcjflootfn(function(){
			flootShowfn()
		})
	})
	
	//关闭熊猫浮层
	function closexmcjflootfn(fn){
		
		$(".flootcjxmBox").fadeOut(400 ,function(){
			if(fn){
				fn();
			}
		}) //css({display:"none"});
		// TweenMax.to(".flootcjxmCon",0.4,{opacity:1,scale:1.2,repeat:0,delay:0,onComplete:function(){
		// 	if(fn){
		// 		fn();
		// 	}
			
		// }})
	}

	
	
	
	
	//熊猫抽奖
	$(".choujiangxmbtn").click(function(e){
		e.preventDefault()
		$(".loadingbox").css({display:"block"})
		closexmcjflootfn(function(){
			zhongjiangfn();
		})
		
		
	})
	function zhongjiangfn(){ //是否中奖
		console.log("1"+zhongjianged)
		if(!zhongjianged){
			
			$("#zjybox").css({display:"block"})
			$("#zjnbox").css({display:"none"})
			$(".jiangpinlistbox").append('<img src="images/btn-yhq.png" class="jpListitem yhqbtn" />'); // 优惠券
			setTimeout(function(){
				useyhqfn();
			},10)
			//setTimeout(function(){
			TweenMax.to(".flootzjImgbg",0.4,{opacity:1,scale:1.5,ease:Back.easeOut.config(1),repeat:0,delay:0.2})
			//},400)
			//console.log("1"+zhongjianged)
		}else if(zhongjianged){
			//console.log("2"+zhongjianged)
			$("#zjybox").css({display:"none"})
			$("#zjnbox").css({display:"block"})
		}
		zhongjianged=true; 
		$(".loadingbox").css({display:"none"})
		$(".flootzjBox").fadeIn(400 , function(){
			cjNum--
			if(cjNum <=0){
				cjNum=0;
				$(".tips").text('').css({display:"none"})
			}else{
				$(".tips").text(cjNum).css({display:"block"})
			}
			
		}) //css({display:"block"});
	}
	
	// 集徽章抽奖
	$(".choujianghzbtn").click(function(e){
		e.preventDefault();
		$(".loadingbox").css({display:"block"})
		$(".flootcjBox").fadeOut(400,function(){
			zhongjiangfn();
		})
		// TweenMax.to(".flootcjCon",0.4,{opacity:1,scale:1.2,repeat:0,delay:0,onComplete:function(){
		// 	zhongjiangfn();
		// }})
	})
		
	
	$(".closezjbtn").click(function(e){
		e.preventDefault()
		$(".flootzjBox").fadeOut(400)
	})
	
	// 关闭 幸运儿 小黄人浮层
	$(".closexyexhrbtn").click(function(e){  
		e.preventDefault()
		$(".flootcjxhrBox").fadeOut(400,function(){
			flootShowfn()
		}) //css({display:"none"});
		/*TweenMax.to(".flootcjxhrBox",0.4,{opacity:1,scale:1.2,repeat:0,delay:0,onComplete:function(){
			
			flootShowfn()
			
		}})*/
		
		
	})
	
	
	//打开背包
	$(".btnbeibaopic").click(function (){
		$(".dhcodebox").css({display:"none"})
		//$(".flootcjxhrBox").fadeOut(400);  // 关闭 幸运儿 小黄人浮层
		//$(".flootcjxmBox").fadeOut(400); // 关闭熊猫抽奖
		//$(".flootzjBox").fadeOut(400); // 关闭中奖浮层
		//$(".flootcjBox").fadeOut(400); // 关闭抽奖浮层
		//closefloothzfn();
		var showbeibao = $(".beibaobox")[0].style.display;
		if(showbeibao == 'none'){
			$(".beibaobox").fadeIn(400)
		}else{
			$(".beibaobox").fadeOut(400)
		}
		
		
	})
	
	$(".bbtxt").click(function(e){
		e.preventDefault()
		$(".beibaobox").fadeOut(400)
	})
	
	
	$(".beibaocjbtn").click(function(e){
		e.preventDefault();
		
		
		if(cjNum<=0){
			$(".beibaobox").fadeOut(250,function(){
				$(".chywbox").fadeIn(250)
			})
			return;
		}
		
		$(".icon1").addClass("icon1anim");
		$(".icon2").addClass("icon2anim");
		setTimeout(function(){
			$(".loadingbox").css({display:"block"});
			
			$(".beibaobox").fadeOut(100,function(){
				zhongjiangfn();
				$(".icon1").removeClass("icon1anim");
				$(".icon2").removeClass("icon2anim");
			})
		},400)
		
	})
	
	// 使用兑换环球幸运儿
	function usehqxyefn(){
		$(".dhbtn").click(function(e){
			e.preventDefault()
			if(cjNum<=0){
				$(".tips").css({display:"none"});
			}
			
			$(".loadingbox").css({display:"block"});
			$(".beibaobox").fadeOut(250,function(){
				$(".dhcodebox").fadeIn(250)
				$(".loadingbox").css({display:"none"});
			})
		})
		}
	
	// 使用优惠券
	function useyhqfn(){
		$(".yhqbtn").click(function(e){
			e.preventDefault()
			if(cjNum<=0){
				$(".tips").css({display:"none"});
			}
			
			$(".loadingbox").css({display:"block"});
			$(".beibaobox").fadeOut(250,function(){
				$(".dhqrcodebox").fadeIn("250")
				$(".loadingbox").css({display:"none"});
			})
		})
		}
	
	
	$(".closedhcodebtn").click(function(e){
		e.preventDefault();
		$(".dhcodebox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250);
		})
		
	})
	$(".dhmtxt").click(function(e){
		e.preventDefault();
		$(".dhcodebox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250);
		})
		
	})
	
	$(".chywtxt").click(function(e){
		e.preventDefault();
		$(".chywbox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250);
		})
		
	})
	
	$(".closedhqrcodebtn").click(function(e){
		e.preventDefault();
		$(".dhqrcodebox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250);
		})
		
	})
	$(".dhqrcodetxt").click(function(e){
		e.preventDefault();
		$(".dhqrcodebox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250);
		})
		
	})
	
	$(".closechywbtn").click(function(e){
		e.preventDefault();
		$(".chywbox").fadeOut(250 , function(){
			$(".beibaobox").fadeIn(250)
		})
	})
	
	
	
	function floot3allfn(){
		
	}
	
	function clickstepnum(){ // 计算点击次数
		var step = 0;
		for(var i=0; i<$(".btndl").length;i++){
			var btnclicked = $(".btndl").eq(i)[0].clicked;
			if(btnclicked){
				step++;
			}
		}
		if(step == 7){
			$(".flootLogo").css({display:"block"});
			
		}
		
		return step;
	}
	
	
	
	
	//关闭抽奖浮层
	$(".closecjbtn").click(function(e){
		e.preventDefault()
		$(".flootcjBox").fadeOut(400)
		//TweenMax.to(".flootcjCon",0.4,{opacity:1,scale:1.2,repeat:0,delay:0,onComplete:function(){}})
	})
	
	//flootShowfn() 显示印章
	
	function flootShowfn(){
		/*$(".flootBox").fadeIn(250 , function(){
			TweenMax.to(".flootCon",0.4,{opacity:1,scale:1,ease:Back.easeOut.config(1),repeat:0,delay:0})
		})*/
		$(".flootBox").fadeIn(400)
		TweenMax.to(".flootCon",0.4,{opacity:1,scale:1,ease:Back.easeOut.config(1),repeat:0,delay:0})
	}
	
	//关闭徽章按钮
	$(".closeFloot").click(function(e){
		e.preventDefault();
		closefloothzfn()
	})
	
	function closefloothzfn(){
		$(".flootBox").fadeOut(400)
		TweenMax.to(".flootCon",0.4,{opacity:0,scale:0.5,ease:Back.easeOut.config(1),repeat:0,delay:0,onComplete:function (){
			
			var cstep = clickstepnum();
			if(cstep == 3 && !show3cj){
				show3cj=true
				$("#cj3box").css({display:"block"})
				$("#cjallbox").css({display:"none"})
				cjflootshowfn()
			}else if(cstep == 7 && !showallcj){
				showallcj=true
				$("#cj3box").css({display:"none"})
				$("#cjallbox").css({display:"block"})
				cjflootshowfn()
			}
		}
			
		})
		
	}
	
	//zjflootshowfn() //显示抽奖
	function cjflootshowfn(){
		$(".flootcjBox").fadeIn(250)
		TweenMax.to(".flootcjCon",0.4,{opacity:1,scale:1,ease:Back.easeOut.config(1),repeat:0,delay:0})
		cjTips();
	}
	
    var clickOffMusic = false;
	var playing=false;
	var music = document.getElementById("music");
	//music.volume = 0.2;
	music.addEventListener("play", playfn,false)
	music.addEventListener("pause", pausefn,false)
	music.play();
	$(".musicbtnbox").click(function(e){
		e.preventDefault()
		console.log(playing)
		
		if(!playing){
			music.play();
			playing=true;
			clickOffMusic=false;
		}else{
			music.pause();
			playing=false;
			clickOffMusic=true;
		}
	})
	
	
	
	function playfn(e){
		playing=true;
		$(".bgmon").css({display:"block"})
		$(".bgmoff").css({display:"none"})
		$(".musicbtnbox").addClass("rotateanim")
		}
	function pausefn(e){
		playing=false;
		$(".bgmon").css({display:"none"})
		$(".bgmoff").css({display:"block"})
		$(".musicbtnbox").removeClass("rotateanim")
	}
	
	function getElemTop(obj) {
	    var rect = obj.getBoundingClientRect();
	    return rect.top;
	}
	wx.ready(function(){
		music.play();
	})
	
	document.addEventListener("WeixinJSBridgeReady", function (e) { 
		music.play();
		}, false);
	
	$(".rulebtn").click(function(e){
		e.preventDefault();
		$(".rulebox").fadeIn();
	})
	
	
	// 页面滚动动画
	var animplay=[false , false , false , false , false , false , false , false]
	var scrolltopend = false;
	$(".closerule").click(function(){
		$(".rulebox").fadeOut(400);
		if(!clickOffMusic){
			$("#music")[0].play();
		}
		console.log(animplay , scrolltopend)
		setTimeout(function(){
			$(window).scroll(function(e){
				getdivtopfn()
			})
			baozhuanim()
			getdivtopfn()
			
		},800)
		
	})
	
	
	/* $(window).scroll(function(e){
		getdivtopfn()
	})
	getdivtopfn() */
	
	
	function baozhuanim(){ // 爆竹动画
		var baozhutop=$(".baozhu1")[0].offsetTop + 150;
		var ww = $(window).width();
		console.log(baozhutop)
		TweenMax.to(".baozhu1",0.8,{y:-baozhutop,x:-(ww*0.1),scale:1,repeat:0,delay:0,onComplete:function(){
			$(".baozhu1").css({display:"none"})
			$(".baozhu2").css({display:"none"})
			
			
			
		}})
		TweenMax.to(".baozhu2",0.8,{y:-baozhutop,x:ww*0.3,scale:1,repeat:0,delay:0,onComplete:function(){}})
		
		TweenMax.to(".yanhua1",0.5,{scale:1,opacity:1,repeat:0,delay:0.2,onComplete:function(){}})
		TweenMax.to(".yanhua2",0.5,{scale:1,opacity:1,repeat:0,delay:0.4,onComplete:function(){}})
		TweenMax.to(".yanhua3",0.5,{scale:1,opacity:1,repeat:0,delay:0.6,onComplete:function(){
			setTimeout(function(){
				ssjanim();
				setTimeout(function(){
					hlbtanim();
					
				},1000)
			},500)
		}})
		
		
		
	}
	
	
	/* window.onload = function(){
		console.log("onload")
		getdivtopfn()
	} */
	
	$('html, body').animate({ scrollTop: 0 }, 100 , function(){
		if(!scrolltopend){
			console.log("回到顶部")
			scrolltopend = true;
			
		}
	
		
	});
	
	
	function getdivtopfn(){
		if(!scrolltopend){
			return;
		}
		var wh = $(window).height();
		//var ssjtop = $(".shuishijiebox")[0].getBoundingClientRect().top + $(".shuishijiebox")[0].offsetHeight/2; //未来水世界
		//var xmtop = $(".xiongmaobox")[0].getBoundingClientRect().top + $(".xiongmaobox")[0].offsetHeight/2;; //功夫熊猫
		//var hlbttop = $(".halibtbox")[0].getBoundingClientRect().top + $(".halibtbox")[0].offsetHeight/2;; //哈利波特
		var bxjgtop = $(".bxjgbox")[0].getBoundingClientRect().top + $(".bxjgbox")[0].offsetHeight/2;; //变形金刚
		var zljtop = $(".zhuljbox")[0].getBoundingClientRect().top + $(".zhuljbox")[0].offsetHeight/2;; //侏罗纪
		var hlwtop = $(".haolwbox")[0].getBoundingClientRect().top + $(".haolwbox")[0].offsetHeight/2;; //好莱坞
		var xhrtop = $(".xiaohrbox")[0].getBoundingClientRect().top + $(".xiaohrbox")[0].offsetHeight/2;; //小黄人
		
		var snum = 0.7;
		//console.log(wh*snum)
		/*if(ssjtop<=wh*snum && ssjtop>=0 && !animplay[0]){  // 未来水世界
				animplay[0]=true;
				console.log("未来水世界:"+ssjtop)
		}
		if(xmtop<=wh*snum && xmtop>=0 && !animplay[1]){ //功夫熊猫
				animplay[1]=true;
				console.log("功夫熊猫:"+xmtop)
		}
		if(hlbttop<=wh*snum && hlbttop>=0 && !animplay[2]){ //哈利波特
				animplay[2]=true;
				console.log("哈利波特:"+hlbttop)
		}*/
		
		if(bxjgtop<=wh*snum && bxjgtop>=0 && !animplay[3]){ //变形金刚
				animplay[3]=true;
				bxjganim()
				console.log("变形金刚:"+bxjgtop)
		}
		
		if(zljtop<=wh*snum && zljtop>=0 && !animplay[4]){ //侏罗纪
				animplay[4]=true;
				zljanim()
				console.log("侏罗纪:"+zljtop)
		}
		
		if(hlwtop<=wh*snum && hlwtop>=0 && !animplay[5]){ //好莱坞
				animplay[5]=true;
				hlwanim();
				console.log("好莱坞:"+hlwtop)
		}
		
		if(xhrtop<=wh*snum && xhrtop>=0 && !animplay[6]){ //小黄人
				animplay[6]=true;
				xhranim()
				console.log("小黄人:"+xhrtop)
		}
		
		//console.log(wh)
	}
	
	
	
	
	
	
	function ssjanim(){ // 水世界 动画
		TweenMax.to(".ssjquan",0.8,{x:0,y:50,repeat:0,delay:0,onComplete:function(){}})
	}
	function xmanim(){ // 熊猫动画
		$(".laoshu").addClass("laoshuanim");
	}
	function hlbtanim(){ // 哈利波特 动画
		TweenMax.to(".maotouyin",0.5,{opacity:1,scale:1,ease:Back.easeOut.config(3),onComplete:function(){}})
	}
	function zljanim(){ // 侏罗纪 动画
		$(".carlight").fadeIn()
	}
	
	function bxjganim(){ // 变形金刚 动画
		TweenMax.to(".bxjganimpic",0.5,{x:0,repeat:0,delay:0,onComplete:function(){}})
	}
	function hlwanim(){ // 好莱坞 动画
		$(".hlwname2").fadeIn()
	}
	function xhranim(){ // 小黄人 动画
		$(".xhrpicanim").addClass("xhranimkey")
	}
	
	//地图定位
	
	
	
	var map=null;
	var marker=null;
	var geolocation = null;
	
	var myPoint=[];
	
	
	
	$(".onoffPoint").click(function(e){
		e.preventDefault();
		if(!getPoint){
			getPoint=true;
			myPoint=[];
			$(this).text('定位开启')
			$(".latlngbox").text('').css({display:"block"})
		}else{
			getPoint=false;
			myPoint=[];
			$(this).text('定位关闭')
			$(".latlngbox").text('').css({display:"none"})
		}
		console.log("getPoint:"+getPoint)
	})
	
	/* map = new TMap.Map("mapContainer", {
						zoom:15, 
						center: new TMap.LatLng(39.916527,116.397128)
					}); */
	
	//提前打开定位授权
	geolocation = new qq.maps.Geolocation(
	  "EJDBZ-GHO3D-MB24R-HJ3FZ-2B3Y6-52FBX",
	  "myapp"
	);
	geolocation.getLocation(
	  res => {
		 var lat = res.lat;
		 var lng = res.lng;
		 console.log('getLocation:' + lat + ',' + lng)
		  // 再苹果手机浏览器 获取不到经纬度 ios14
	  },
	  null,
	  {
		timeout: 1000,
		failTipFlag: true
	  }
	);
	
	function initMap(){  // 初始化地图
		//var lat = 39.916527
		//var lng = 116.397128
		
		
		geolocation.getLocation(
		  res => {
		     var lat = res.lat;
		     var lng = res.lng;
		     console.log('getLocation:' + lat + ',' + lng)
		     
			 
		   
		  },
		  null,
		  {
		    timeout: 1000,
		    failTipFlag: true
		  }
		);	
		
		geolocation.watchPosition(res => {
			
			var lat = res.lat;
			var lng = res.lng;
			//console.log('watchPosition: '+lat + ',' + lng)
			
			if(map == null){
				createMap(lat , lng)
				return
			}else{
			
				var lat = res.lat;
				var lng = res.lng;
				//console.log(lat + ',' + lng)
				$(".latlngbox").css({display:"block"}).text(lat + ',' + lng)
				map.setCenter(new TMap.LatLng(lat, lng));
				
				marker.setGeometries([
					{
					  "id": 'geometries0',
					  "styleId": 'marker',
					  position: new TMap.LatLng(lat, lng)
					}
				  ]);
			}
				//console.log(res.lat + ',' + res.lng)
		
		})
		
	
	}
	
	
	
	function createMap(lat , lng ){
		$(".latlngbox").css({display:"block"}).text(lat + ',' + lng)
		$(".maploading").css({display:"none"})
		if(map){return}
		map = new TMap.Map("mapContainer", {
							zoom:12, // 设置地图缩放级别
							center: new TMap.LatLng(lat,lng), // 设置地图中心点坐标
						});
		
		marker = new TMap.MultiMarker({
						id: 'marker-layer0',
						map: map,
						styles: {
							"marker": new TMap.MarkerStyle({
								"width": 15,
								"height": 15,
								//"anchor": { x: 0, y: 0 }, // 没有锚点默认为{ x: width/2, y: height }；
								"src": pos //'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerNew.png' // images/pos.png
							})
						},
						geometries: [{
							"id": 'geometries0',
							"styleId": 'marker',
							"position": new TMap.LatLng(lat,lng),
							"properties": {
								"title": "marker"
							}
						}]
					});
	}
	
	function destroyMap(){ // 销毁地图
		/* geolocation.clearWatch();
		map.destroy();
		map=null;
		marker=null;
		geolocation = null;
		$("#mapContainer").html('') */
	}
	
	/* geolocation.getLocation(
	  res => {
	     console.log(`${res.lat}, ${res.lng}`);
	   
	  },
	  null,
	  {
	    timeout: 1000,
	    failTipFlag: true
	  }
	); */
	
	//getLocationfn();
	function getLocationfn(){
		geolocation.getLocation(res=>{
			var lat = res.lat;
			var lng = res.lng;
			console.log(lat + ',' + lng)
			$(".latlngbox").css({display:"block"}).text(lat + ',' + lng)
			map.setCenter(new TMap.LatLng(lat, lng));
			
			marker.setGeometries([
				{
				  "id": 'geometries0',
				  "styleId": 'marker',
				  position: new TMap.LatLng(lat, lng)
				}
			  ]);
			
							
			/* setTimeout(function(){
				getLocationfn();
			},2000) */
			
			console.log(res.lat + ',' + res.lng)
		})
		
	}
	
	
	
	
	$(".btndl").click(function(e){
		e.preventDefault();
		
		//var itemName = $(this).attr("item");
		clickBtnName = $(this).attr("item");
		//$("."+itemName).css({display:"block"});
		//$(this)[0].clicked = true;
		clickBtnStep = $(this).attr("bstep")
		beforequerendwfn(clickBtnName)
		
		//console.log(clickBtnStep)
		//marker.geometries[0].position=new TMap.LatLng(30.51651,117.094022);
	})	
	
	
	$(".dw-f-getbtn").click(function(e){
		e.preventDefault();
		if(map == null){return}
		//var itemName =$("."+clickBtnName).attr('item') //pointname[goStep];
		$(".dwfloottsbox").fadeOut(200 , function(){
			dwshowhzhangfn(clickBtnName)
			destroyMap();
		})
		
		
	})
	$(".closedwfloot").click(function(e){
		e.preventDefault();
		$(".dwfloottsbox").fadeOut(400 , function(){
			destroyMap();
		});
	})
	
	function beforequerendwfn(clickBtnName){
		//var clasName = '.dw-'+ clickBtnName;
		//$("img.dwpicitem").css({display:"none"});
		//setTimeout(function(){
			//$(clasName).css({display:"block"});
			$(".maploading").css({display:"block"})
			$(".dwfloottsbox").fadeIn(500)
			setTimeout(function(){
				if(map){
					getLocationfn();
				}else{
					initMap()
				}
				
			},50)
			
		//},10)
	}
	
	function dwshowhzhangfn(itemName){  //弹出徽章
		$("."+itemName).css({display:"block"});
		//$('.btndl')[goStep].clicked = true;
		$('.btndl')[clickBtnStep].clicked = true;
		if(itemName == 'floot-xhr' && !showxhrfloot){
			showxhrfloot=true;
			//$(".dhbtn").css({display:"block"})
			$(".flootcjxhrBox").fadeIn(400)//css({display:"block"});
			
			$(".jiangpinlistbox").append('<img src="images/btn-dh.png" class="jpListitem dhbtn" />'); // 小黄人 环球幸运儿
			setTimeout(function(){
				usehqxyefn();
			},10)
			
		}else if(itemName == 'floot-xm' && !showxmyckfloot){
			showxmyckfloot=true;
			$(".flootcjxmBox").fadeIn(400) //css({display:"block"});
			
			
			cjTips()
		}else{
			flootShowfn()
			
		}
		goStep++;
	}
	
	
$(".preventbg")[0].addEventListener("touchstart" , function(e){
	e.preventDefault();
},false)
 $(".preventbg")[1].addEventListener("touchstart" , function(e){
	e.preventDefault();
},false) 
 $(".rulepic")[0].addEventListener("touchstart" , function(e){
	e.preventDefault();
},false) 
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	})

function loadImg(src , fn){
	var image=new Image();
	image.onload = fn;
	image.src=src;
}	

String.prototype.trim = function () {
    return this.replace(/(^\s*)|(\s*$)/g, "");

}

function checkPhone(phone){ 
	if(!(/^1[3|4|5|6|7|8|9]\d{9}$/.test(phone))){ 
	return false; 
	}else{
		return true;
		} 
}




function setCss3 (obj,attrObj) {
   for (var i in attrObj) {
     var newi=i;
	 if(newi.indexOf("-")>0){
	   var num=newi.indexOf("-");
	   newi=newi.replace(newi.substr(num,2),newi.substr(num+1,1).toUpperCase());
	 }
	 obj.style[newi]=attrObj[i];
	 newi=newi.replace(newi.charAt(0),newi.charAt(0).toUpperCase());
	 obj.style["webkit"+newi]=attrObj[i];
	 obj.style["moz"+newi]=attrObj[i];
	 obj.style["o"+newi]=attrObj[i];
	 obj.style["ms"+newi]=attrObj[i];
   }
  }
